import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/components/login/Login'
import Home from '@/components/home/Home'
import HomeOn from '@/components/home/HomeOn'
import ShopManage from '@/components/shop/ShopManage'
import ShopCategory from '@/components/shop/ShopCategory'
import Order from '@/components/order/Order'
import Orderdetail from '@/components/order/Orderdetail'
import UserList from '@/components/user/UserList'
import ShopDetail from '@/components/shop/ShopDetail'
import ShopUpdate from '@/components/shop/ShopUpdate'
import ShopAdd from '@/components/shop/ShopAdd'
import Echarts from '@/components/echarts/Echarts'
import Bmap from '@/components/echarts/Bmap'
import addcate from '@/components/shop/addcate'
import cateitem from '@/components/shop/cateitem'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Home',
      component:Home,
      meta:{
        requireAuth:true,
        title:"系统首页"
      },
      children:[//二级路由
        {
          path:"homeon",
          name:"HomeOn",
          component:HomeOn,
          meta:{
            requireAuth:true,
            title:"系统首页--home主页部分"
          },
        },
        {
          path:"echarts",
          name:"Echarts",
          component:Echarts,
          meta:{
            title:"Echarts图表部分"
          },
        },
        {
          path:"shopmanage",
          name:"ShopManage",
          component:ShopManage,
          title:"商品管理"
        },
        {
          path:"shopcategory",
          name:"ShopCategory",
          component:ShopCategory,
        },
        {
          path:"cateitem",
          name:"cateitem",
          component:cateitem,
        },
        {
          path:"addcate",
          name:"addcate",
          component:addcate,
        },
        {//查看详情页
          path:"shopdetail/:id",
          name:"ShopDetail",
          component:ShopDetail,
        },
        {//商品编辑
          path:"shopupdate/:id",
          name:"ShopUpdate",
          component:ShopUpdate,
        },
        {
          path:"shopadd",
          name:"ShopAdd",
          component:ShopAdd,
        },
        {
          path:"order",
          name:"Order",
          component:Order,
        },
        {
          path:"orderdetail",
          name:"Orderdetail",
          component:Orderdetail,
        },
        {
          path:"userlist",
          name:"UserList",
          component:UserList,
        }, 
        {
          path:"bmap",
          name:"Bmap",
          component:Bmap,
          meta:{
            title:"Bmap地图"
          },
        },
      ],
      redirect:"/homeon"
    },
     
    {
      path: '/login',
      name: 'Login',
      component: Login,
      meta:{title:"登录系统"}
    },
  ]
})
